<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
		<link href="../css/sfmain.css" rel="stylesheet" type="text/css"></link>
		<script src="../js/jquery-1.11.3.min.js"></script>
		<script src="../js/common.js"></script>
<!--		<script src="../js/sqlite.js"></script>-->
<!--		<script src="../js/ybrq.js"></script>-->
		<script>
		$(function() {
			selectNewData();
		 });
		function saveInfo(){
            var happentime = $("#happentime").val();//随访日期
            var visityType = $("input[name='sffs']:checked").val();//随访方式
            var tw = $("#tw").val();//体温
            var ml = $("#ml").val();//脉率
            var hxpl = $("#hxpl").val();//呼吸频率
            var gy = $("#gy").val();//高压
            var dy = $("#dy").val();//低压
            var height = $("#height").val();//身高
            var weight = $("#weight").val();//体重
            var yaowei = $("#yaowei").val();//腰围
            var bmi = $("#bmi").val();//bmi
            var ysxg = "";//饮食习惯
			$('input:checkbox[name=ysxg]:checked').each(function (i) {
				if (0 == i) {
					ysxg = $(this).val();
				} else {
					ysxg += ("," + $(this).val());
				}
			});

            var xyqk = $("input[name='xyqk']:checked").val();//吸烟情况
            var rxyl = $("#rxyl").val();//日吸烟量
            var yjpl = $("input[name='yjpl']:checked").val();//饮酒频率
            var ryjl = $("#ryjl").val();//日饮酒量
            var sfjj = $("input[name='sfjj']:checked").val();//是否戒酒
            var jjnl = $("#jjnl").val();//戒酒年龄
            var zybjcs = $("input[name='zybjcs']:checked").val();//职业病危害因素接触史
            var gz = $("#gz").val();//工种
            var cysj = $("#cysj").val();//从业时间
            var fc = $("#fc").val();//粉尘
            var fcfhcs = $("input[name='fcfhcs']:checked").val();//粉尘防护措施有无
            var fcfhcsc = $("#fcfhcsc").val();//粉尘防护措施

            var fswz = $("#fswz").val();//放射物质
            var fswzfhcs = $("input[name='fswzfhcs']:checked").val();//放射物质防护措施有无
            var fswzfhcsc = $("#fswzfhcsc").val();//放射物质防护措施

            var wlys = $("#wlys").val();//物理因素
            var wlysfhcs = $("input[name='wlysfhcs']:checked").val();//物理因素防护措施有无
            var wlysfhcsc = $("#wlysfhcsc").val();//物理因素防护措施

            var hxwz = $("#hxwz").val();//化学物质
            var hxwzfhcs = $("input[name='hxwzfhcs']:checked").val();//化学物质防护措施有无
            var hxwzfhcsc = $("#hxwzfhcsc").val();//化学物质防护措施

            var qtdw = $("#qtdw").val();//其他
            var qtdwfhcs = $("input[name='qtdwfhcs']:checked").val();//其他防护措施有无
            var qtdwfhcsc = $("#qtdwfhcsc").val();//其他防护措施

            var wxyskz = $("input[name='wxyskz']:checked").val();//危险因素控制
            $('input:checkbox[name=wxyskz]:checked').each(function (i) {
					if (0 == i) {
						wxyskz = $(this).val();
					} else {
						wxyskz += ("," + $(this).val());
					}
				});
            var mbtz = $("#mbtz").val();//目标体重
            var wxyskzqt = $("#wxyskzqt").val();//危险因素控制其他


            var sfys = $("#sfys").val();//随访医生
            var insertsql = "insert into ybrq(id,personid,name,sex,happentime,visityType,tw,ml,hxpl,gy,dy,height,weight,yaowei,bmi,ysxg,xyqk,rxyl,yjpl,"
                                +"ryjl,sfjj,jjnl,zybjcs,gz,cysj,fc,fcfhcs,fcfhcsc,fswz,fswzfhcs,fswzfhcsc,wlys,wlysfhcs,wlysfhcsc,hxwz,hxwzfhcs,hxwzfhcsc,"
                                +"qtdw,qtdwfhcs,qtdwfhcsc,wxyskz,mbtz,wxyskzqt,sfys) values("
                            +"'"+Math.floor(Math.random()*10)+"',"
                            +"'"+personid+"',"
                            +"'"+name+"',"
                            +"'"+sex+"',"
                            +"'"+happentime+"',"
                            +"'"+visityType+"',"
                            +"'"+tw+"',"
                            +"'"+ml+"',"
                            +"'"+hxpl+"',"
                            +"'"+gy+"',"
                            +"'"+dy+"',"
                            +"'"+height+"',"
                            +"'"+weight+"',"
                            +"'"+yaowei+"',"
                            +"'"+bmi+"',"
                            +"'"+ysxg+"',"
                            +"'"+xyqk+"',"
                            +"'"+rxyl+"',"
                            +"'"+yjpl+"',"
                            +"'"+ryjl+"',"
                            +"'"+sfjj+"',"
                            +"'"+jjnl+"',"
                            +"'"+zybjcs+"',"
                            +"'"+gz+"',"
                            +"'"+cysj+"',"
                            +"'"+fc+"',"
                            +"'"+fcfhcs+"',"
                            +"'"+fcfhcsc+"',"
                            +"'"+fswz+"',"
                            +"'"+fswzfhcs+"',"
                            +"'"+fswzfhcsc+"',"
                            +"'"+wlys+"',"
                            +"'"+wlysfhcs+"',"
                            +"'"+wlysfhcsc+"',"
                            +"'"+hxwz+"',"
                            +"'"+hxwzfhcs+"',"
                            +"'"+hxwzfhcsc+"',"
                            +"'"+qtdw+"',"
                            +"'"+qtdwfhcs+"',"
                            +"'"+qtdwfhcsc+"',"
                            +"'"+wxyskz+"',"
                            +"'"+mbtz+"',"
                            +"'"+wxyskzqt+"',"
                            +"'"+sfys+"'"
                            +")";
            var jg = app.InsertSql(insertsql);
            if("success"==jg){
                alert("操作成功！");
            }
}
function selectNewData(){
	var selectsql = 'select * from ybrq where personid='+personid+" order by happentime desc";
	var data = app.getInfo2(selectsql);
	var obj = eval('(' + data + ')');
		if(null!=obj&&obj.length>0){
			var info = obj[0];
			$("#xm").html(info.name);
			$("#xb").html(info.sex);
			$("#happentime").val(info.happentime);//随访日期
			$("input[name='sffs'][value='"+info.visityType+"']").prop("checked",true);//随访方式
			$("#tw").val(info.tw);//体温
			$("#ml").val(info.ml);//脉率
			$("#hxpl").val(info.hxpl);//呼吸频率
			$("#gy").val(info.gy);//高压
			$("#dy").val(info.gy);//低压
			$("#height").val(info.height);//身高
			$("#weight").val(info.weight);//体重
			$("#yaowei").val(info.yaowei);//腰围
			$("#bmi").val(info.bmi);//bmi
				var ysxg = info.ysxg;//饮食习惯
					if(null!=ysxg&&ysxg.length>0){
					$(ysxg.split(",")).each(function (i,e){
						$("input[name='ysxg'][value='"+e+"']").prop("checked",true);
					});
				}
			$("input[name='xyqk'][value='"+info.xyqk+"']").prop("checked",true);;//吸烟情况
			$("#rxyl").val(info.rxyl);//日吸烟量
			$("input[name='yjpl'][value='"+info.yjpl+"']").prop("checked",true);//饮酒频率
			$("#ryjl").val(info.ryjl);//日饮酒量
			$("input[name='sfjj'][value='"+info.sfjj+"']").prop("checked",true);//是否戒酒
			$("#jjnl").val(info.jjnl);//戒酒年龄
			$("input[name='zybjcs'][value='"+info.zybjcs+"']").prop("checked",true);//职业病危害因素接触史
			$("#gz").val(info.gz);//工种
			$("#cysj").val(info.cysj);//从业时间
			$("#fc").val(info.fc);//粉尘
			$("input[name='fcfhcs'][value='"+info.fcfhcs+"']").prop("checked",true);//粉尘防护措施有无
			$("#fcfhcsc").val(info.fcfhcsc);//粉尘防护措施

			$("#fswz").val(info.fswz);//放射物质
			$("input[name='fswzfhcs'][value='"+info.fswzfhcs+"']").prop("checked",true);//放射物质防护措施有无
			$("#fswzfhcsc").val(info.fswzfhcsc);//放射物质防护措施

			$("#wlys").val(info.wlys);//物理因素
			$("input[name='wlysfhcs'][value='"+info.wlysfhcs+"']").prop("checked",true);//物理因素防护措施有无
			$("#wlysfhcsc").val(info.wlysfhcsc);//物理因素防护措施

			$("#hxwz").val(info.hxwz);//化学物质
			$("input[name='hxwzfhcs'][value='"+info.hxwzfhcs+"']").prop("checked",true)//化学物质防护措施有无
			$("#hxwzfhcsc").val(info.hxwzfhcsc);//化学物质防护措施

			$("#qtdw").val(info.qtdw);//其他
			$("input[name='qtdwfhcs'][value='"+info.qtdwfhcs+"']").prop("checked",true);//其他防护措施有无
			$("#qtdwfhcsc").val(info.qtdwfhcsc);//其他防护措施

			var wxyskz = info.wxyskz;//危险因素控制
			if(null!=wxyskz&&wxyskz.length>0){
				$(wxyskz.split(",")).each(function (i,e){
					$("input[name='wxyskz'][value='"+e+"']").prop("checked",true);
				});
				}

			$("#mbtz").val(info.mbtz);//目标体重
			$("#wxyskzqt").val(info.wxyskzqt);//危险因素控制其他

			 $("#sfys option[value='"+info.sfys+"']").attr("selected","selected");//随访医生
		}

}
		</script>
	</head>
	<body>
		<div class="dh">
			<div class="dhleft">
				<span>一般人群随访服务记录表</span>
			</div>
			<div class="bc" onclick="saveInfo()">
				<img  class="bcimg" src="../img/icon-save.png"/>
				<span class="bcspan">保存</span>
			</div>
		</div>
		<div class="maindiv">
			<div class="sfxx">
				<span class="sfxxspan">随访信息</span>
			</div>
			<div>
				<hr class="titleline" />
			</div>
			<div class="titlaspan">
				<span>基本信息</span>
      </div>
      <div class="titlebody">
        <div>
			<span class="span1">姓名：</span>
			<span  id="xm" style="margin-left:5px;"></span>
			<span class="span1" style="margin-left: 100px;" >性别：</span>
			<span  id="xb" style="margin-left:5px;"></span>
        </div>
        <div>
          <span class="span1">随访日期：</span>
          <input class="timeinput" id="happentime" type="date"/>
          
        </div>
		<div>
		  <span class="span1" >随访方式：</span>
		  <input class="radio_type" type="radio" value="1" name="sffs" id="sffs1" checked="checked"/>
		  <label for="sffs1">门诊</label>
		  <input class="radio_type" type="radio" value="2" name="sffs" id="sffs2" /> 
		  <label for="sffs2">家庭</label>
		  <input class="radio_type" type="radio" value="3" name="sffs" id="sffs3" />
		  <label for="sffs2">通过电话或者手机短信（微信）联系患者本人或者家人</label><br>
			<input class="radio_type" type="radio" style="margin-left: 105px;" value="4" name="sffs" id="sffs4" />
		  <label for="sffs4">其他地方进行面对面教育</label>
		  <input class="radio_type" type="radio" value="5" name="sffs" id="sffs5" />
		  <label for="sffs5">其他</label>
		</div>
      </div>
	  
		<div class="titlaspan">
		<span>一般情况</span>
      </div>
		<div class="titlebody">
			<div>
				<span class="span1">体温(℃)：</span>
				<input type="number" class="inputcss" style="width: 60px;" id="tw"/>
				<span class="span2">脉率(次/分钟)：</span>
				<input type="number" class="inputcss" style="width: 60px;" id="ml"/>
				<span class="span2">呼吸频率(次/分钟)：</span>
				<input type="number" class="inputcss" style="width: 60px;" id="hxpl"/>
			</div>
			<div>				
				<span class="span1">血压(mmHg)：</span>
				<input type="number" class="inputcss" placeholder="高压"  style="width: 30px;" id="gy"/><span class="dw">/</span>
				<input type="number" placeholder="低压"  class="inputcss"  style="width: 30px;"    id="dy"/>
				<span class="span2">身高(cm)：</span>
				<input type="number" class="inputcss" style="width:40px;" id="height"/>
				<span class="span2">体重(kg)：</span>
				<input type="number" class="inputcss" style="width:40px;" id="weight"/>
			</div>
			<div>
				
				<span class="span1">腰围(cm)：</span>
				<input type="number" class="inputcss" style="width: 60px;" id="yaowei"/>
				<span class="span2">体质指数(BMI kg/m2)：</span>
				<input type="number" class="inputcss" style="width: 60px;" id="bmi"/>
			</div>
			
		</div>
		<div class="titlaspan">
			生活方式
		</div>
      <div class="titlebody">
		  
        <div>
		  <span class="span1">饮食习惯：</span>
		  <input type="checkbox" class="inputbox" value="1" name="ysxg"/>
		  1荤素均衡
			<input type="checkbox" class="inputbox" value="2" name="ysxg"/>
			2荤食为主
			<input type="checkbox" class="inputbox" value="3" name="ysxg"/>
			3素食为主
			<input type="checkbox" class="inputbox" value="4" name="ysxg"/>
			4嗜盐
			<input type="checkbox" class="inputbox" value="5" name="ysxg"/>
			5嗜油
			<input type="checkbox" class="inputbox" value="6" name="ysxg"/>
			6嗜糖
       </div>   
		<div>
			<span class="span1">吸烟情况：</span>
			<input class="radio_type" type="radio" value="1" name="xyqk" id="xyqk1"/>
			<label for="xyqk1">1从不吸烟</label>
			<input class="radio_type" type="radio" value="2" name="xyqk" id="xyqk2"/>
			<label for="xyqk2">2已戒烟</label>
			<input class="radio_type" type="radio" value="3" name="xyqk" id="xyqk3"/>
			<label for="xyqk3">3吸烟</label>
			<span class="span2">日吸烟量：</span>
			<span class="dw">平均</span>
			<input type="number" class="inputcss" style="width: 30px;"  id="rxyl"/>
			<span class="dw">支</span>
		</div>
		<div>
			<span class="span1">饮酒情况：</span>
			<input class="radio_type" type="radio" value="1" name="yjpl" id="yjqk1"/>
			<label for="yjqk1">1从不</label>
			<input class="radio_type" type="radio" value="2" name="yjpl" id="yjqk2"/>
			<label for="yjqk2">2偶尔</label>
			<input class="radio_type" type="radio" value="3" name="yjpl" id="yjqk3"/>
			<label for="yjqk3">3经常</label>
			<input class="radio_type" type="radio" value="4" name="yjpl" id="yjqk4"/>
			<label for="yjqk4">4每天</label>
		</div>
		<div>
			<span class="span1">日饮酒量：</span>
			<span class="dw">平均</span>
			<input type="number" class="inputcss" style="width:30px;"  id="ryjl"/>
			<span class="dw">两</span>
			<span class="span2">是否戒酒：</span>
			<input class="radio_type" type="radio" value="0" name="sfjj" id="sfjj1"/>
			<label for="sfjj1">是</label>
			<input class="radio_type" type="radio" value="1" name="sfjj" id="sfjj2" /> 
			<label for="sfjj2">否</label>
			<span class="span2">戒酒年龄：</span>
			<input type="number" class="inputcss" style="width: 30px;"  id="jjnl"/>
			<span class="dw">岁</span>
		</div>
	  </div>
		<div >
			<span class="span2">职业病危害因素接触史</span>
		</div>
			<div class="titlebody">
		<div>
			<input class="radio_type" type="radio" value="0" name="zybjcs" id="zybjcs1"/>
			<label for="zybjcs1">无</label>
			<input class="radio_type" type="radio" value="1" name="zybjcs" id="zybjcs2" /> 
			<label for="zybjcs2">有</label>
			<span class="span2">工种</span>
			<input type="text" class="inputcss" style="width: 60px;"  id="gz"/>
			<span class="span2">从业时间</span>
			<input type="number" class="inputcss" style="width: 60px;"  id="cysj"/>
			<span class="dw">年</span>
		</div>
		<div >
			<span class="span1">毒物种类</span>
			
		</div>
		<div>
			<span class="span2">粉尘：</span>
			<input type="text" class="inputcss" style="width: 100px;"  id="fc"/>
			<span class="span2">防护措施：</span>
			<input class="radio_type" type="radio" value="0" name="fcfhcs" id="fcfhcs1"/>
			<label for="fcfhcs1">无</label>
			<input class="radio_type" type="radio" value="1" name="fcfhcs" id="fcfhcs2" /> 
			<label for="fcfhcs2">有</label>
			<input type="text" class="inputcss" style="width:100px;"  id="fcfhcsc"/>
		</div>
		<div>
			<span class="span2">放射物质：</span>
			<input type="text" class="inputcss" style="width: 100px;"  id="fswz"/>
			<span class="span2">防护措施：</span>
			<input class="radio_type" type="radio" value="0" name="fswzfhcs" id="fswzhcs1"/>
			<label for="fswzhcs1">无</label>
			<input class="radio_type" type="radio" value="1" name="fswzfhcs" id="fswzhcs2" />
			<label for="fswzhcs2">有</label>
			<input type="text" class="inputcss" style="width: 100px;"  id="fswzfhcsc"/>
		</div>
		<div>
			<span class="span2">物理因素：</span>
			<input type="text" class="inputcss" style="width: 100px;"  id="wlys"/>
			<span class="span2">防护措施：</span>
			<input class="radio_type" type="radio" value="0" name="wlysfhcs" id="wlysfhcs1"/>
			<label for="wlysfhcs1">无</label>
			<input class="radio_type" type="radio" value="1" name="wlysfhcs" id="wlysfhcs2" /> 
			<label for="wlysfhcs2">有</label>
			<input type="text" class="inputcss" style="width: 100px;"  id="wlysfhcsc"/>
		</div>
		<div>
			<span class="span2">化学物质：</span>
			<input type="text" class="inputcss" style="width: 100px;"  id="hxwz"/>
			<span class="span2">防护措施：</span>
			<input class="radio_type" type="radio" value="0" name="hxwzfhcs" id="hxwzfhcs1"/>
			<label for="hxwzfhcs1">无</label>
			<input class="radio_type" type="radio" value="1" name="hxwzfhcs" id="hxwzfhcs2" /> 
			<label for="hxwzfhcs2">有</label>
			<input type="text" class="inputcss" style="width: 100px;"  id="hxwzfhcsc"/>
		</div>
		<div>
			<span class="span2">其他：</span>
			<input type="text" class="inputcss" style="width: 100px;"  id="qtdw"/>
			<span class="span2">防护措施：</span>
			<input class="radio_type" type="radio" value="0" name="qtdwfhcs" id="qtdwfhcs1"/>
			<label for="qtdwfhcs1">无</label>
			<input class="radio_type" type="radio" value="1" name="qtdwfhcs" id="qtdwfhcs2" /> 
			<label for="qtdwfhcs2">有</label>
			<input type="text" class="inputcss" style="width: 100px;"  id="qtdwfhcsc"/>
		</div>
      </div>
	  <div class="titlaspan">
	  		<span>健康指导</span>
	  </div>
	  <div class="titlebody">
		<div >
			<span class="span1">危险因素控制：</span>
			<input type="checkbox" class="inputbox" value="1" name="wxyskz"/>
			1戒烟
			<input type="checkbox" class="inputbox" value="2" name="wxyskz"/>
			2健康饮酒
			<input type="checkbox" class="inputbox" value="3" name="wxyskz"/>
			3饮食
			<input type="checkbox" class="inputbox" value="4" name="wxyskz"/>
			4锻炼
			<input type="checkbox" class="inputbox" value="5" name="wxyskz"/>
			5减体重<br>
			<input type="checkbox" class="inputbox"  style="margin-left: 105px;"  value="6" name="wxyskz"/>
			6其他
			<input type="text" class="inputcss" style="width: 240px;" id="wxyskzqt"/>
			</div>
			<div>
				<span class="span1">目标体重(kg)：</span>
				<input type="number" class="inputcss" style="width: 60px;"  id="mbtz"/>
			</div>
			
			
	    </div>
	  <div  class="titlebody">
	    <span class="span1">随访医生：</span>
		  <select class="inputcss"   id="sfys">

		  </select>
	  </div>
	 
	</div>
	</body>
</html>
